Object.defineProperty(exports, "__esModule", { value: !0 }),
  (exports.default = void 0);
var e = require("../../@babel/runtime/helpers/classCallCheck"),
  t = require("../../@babel/runtime/helpers/createClass"),
  r = (function () {
    function r() {
      e(this, r);
    }
    return (
      t(r, null, [
        {
          key: "point2PointDistance",
          value: function (e, t) {
            var r =
                arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
              o = e.x - t.x,
              a = e.y - t.y,
              n = 0;
            return r && (n = e.z - t.z), Math.sqrt(o * o + a * a + n * n);
          },
        },
        {
          key: "vector",
          value: function (e, t) {
            return { x: e.x - t.x, y: e.y - t.y };
          },
        },
        {
          key: "vectorCoord",
          value: function (e, t) {
            var r = this.vector(e, t);
            return [r.x, r.y];
          },
        },
        {
          key: "angleBetweenVectors",
          value: function (e, t) {
            var r = e[0],
              o = e[1],
              a = t[0],
              n = t[1],
              s = Math.sqrt(r * r + o * o) * Math.sqrt(a * a + n * n),
              u = (r * a + o * n) / s;
            return ((r * n - o * a) / s > 0 ? -1 : 1) * Math.acos(u);
          },
        },
        {
          key: "getCoordTransform",
          value: function (e, t) {
            var r = this.vectorCoord(t[1], t[0]),
              o = this.vectorCoord(e[1], e[0]),
              a = -this.angleBetweenVectors(r, o),
              n = Math.sin(a),
              s = Math.cos(a);
            return {
              toMapDx: e[0].x - (t[0].x * s - t[0].y * n),
              toMapDy: e[0].y - (t[0].y * s + t[0].x * n),
              toLocalDx: t[0].x - (e[0].x * s + e[0].y * n),
              toLocalDy: t[0].y - (e[0].y * s - e[0].x * n),
              beta: a,
              sin: n,
              cos: s,
            };
          },
        },
      ]),
      r
    );
  })();
exports.default = r;
